﻿using System.ServiceModel;
using BusinessLogic.BusinessEntity.Entities;
using BusinessLogic.Connectivity.Entities;
using System.Collections.Generic;
using System;

namespace BusinessLogic.Connectivity.Interfaces
{
	[ServiceContract]
	public interface IServerContract
	{
		[OperationContract]
		ServerResponse<DocumentEnvelope> ReceiveDocument(DocumentEnvelope envelope, string ticket);

		[OperationContract]
		ServerResponse<User> GetSessionTicket(Credentials credentials);

		[OperationContract]
		ServerResponse<IList<DocumentEnvelope>> GetSentEnvelopes(string ticket);

		[OperationContract]
		ServerResponse<IList<CurrencyConversion>> GetCurrencyConversions();

		[OperationContract]
		ServerResponse<CurrencyConversion> UpdateCurrencyConversion(CurrencyConversion conversion, string ticket);

		[OperationContract]
		ServerResponse<IList<RemittanceAdvice>> GetSentRemittanceAdvices(DateTime startDate, DateTime endDate, string ticket);

		[OperationContract]
		ServerResponse<IList<RemittanceAdvice>> GetReceivedRemittanceAdvices(DateTime startDate, DateTime endDate, string ticket);

		#region Account operations

		[OperationContract]
		ServerResponse<IList<Account>> GetClientAccounts(string ticket);

		[OperationContract]
		ServerResponse<IList<Account>> GetAllAccounts(string ticket);

		[OperationContract]
		ServerResponse<IList<Account>> GetAllAccountsForUser(string ticket);

		[OperationContract]
		ServerResponse<Account> CreateAccount(Account account, string ticket);

		[OperationContract]
		ServerResponse<Account> DeleteAccountById(int accountID, string ticket);

		[OperationContract]
		ServerResponse<Account> ReplenishAccount(int accountID, decimal sumToAdd, string ticket);

		#endregion


		#region User operations

		[OperationContract]
		ServerResponse<User> CreateUser(User user, string sessionTicket);

		[OperationContract]
		ServerResponse<User> SetUserPublicKey(int userID, string publicKey, string sessionTicket);

		[OperationContract]
		ServerResponse<IList<User>> GetAllUsers(string sessionTicket);

		[OperationContract]
		ServerResponse<User> DeleteUser(int clientId, string sessionTicket);


		[OperationContract]
		ServerResponse<IList<Role>> GetRoles();

		[OperationContract]
		ServerResponse<IList<Currency>> GetCurrencies();

		[OperationContract]
		ServerResponse<User> UpdateUser(User user, string ticket);

		[OperationContract]
		ServerResponse<IList<Role>> GetUserRoles(int userID, string ticket);

		[OperationContract]
		ServerResponse<IDictionary<User, IList<Role>>> GetUsersRolePairs(string ticket);

		[OperationContract]
		ServerResponse<User> AssignRole(int userId, Role role, string ticket);

		[OperationContract]
		ServerResponse<User> DeleteRole(int userId, Role role, string ticket);

		#endregion

		#region Currency operations 

		[OperationContract]
		ServerResponse<Currency> CreateCurrency(Currency currency, string ticket);

		[OperationContract]
		ServerResponse<Currency> DeleteCurrency(int currencyID, string ticket);

		[OperationContract]
		ServerResponse<CurrencyConversion> DeleteCurrencyConversion(int currencyConversionID, string ticket);

		[OperationContract]
		ServerResponse<CurrencyConversion> CreateCurrencyConversion(CurrencyConversion conversion, string ticket);

		#endregion

		[OperationContract]
		ServerResponse<IList<DocumentEnvelope>> GetFilteredEnvelopes(string userName, DateTime periodStart, DateTime periodEnd, string ticket);


	}
}